package com.test.daily.leetcode.y2022.m07.day0704.v05;

/**
 * @author Tom on 2022/7/4
 */
public class Solution {
    public int[] evenNums(int[] arr) {
        int eor = 0;
        for (int i = 0; i < arr.length; i++) {
            eor ^= arr[i];
        }
        int rightestOne = eor ^ (~eor + 1);
        int one = 0;
        for (int i = 0; i < arr.length; i++) {
            if ((rightestOne ^ arr[i]) != 0) {
                one = one ^ arr[i];
            }
        }
        int other = one ^ eor;
        return new int[]{one, other};
    }
}
